In [4]:
from setup_notebooks import *
%matplotlib inline
import sys
if DATA_PATH not in sys.path: sys.path.append(DATA_PATH)
from constants import *
In [5]:
%matplotlib inline
display(HTML("<style>.container { width:100% !important; }</style>"))
pd.set_option('display.max_rows', 6)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 800)
pd.set_option('precision', 2)
%precision 4
%pprint
In [6]:
from gensim.models import Word2Vec
For now let's use the Google News model (300 topics)
In [8]:
wv = Word2Vec.load_word2vec_format(os.path.join(DATA_PATH, 'local', 'GoogleNews-vectors-negative300.bin.gz'), binary=True)
In [7]:
wv.most_similar(positive=['python', 'snake',], negative=['programming'])
Out[7]:
In [9]:
wv.most_similar(positive=['PyCon'])
Out[9]:
In [15]:
wv.most_similar(positive=['Portland', 'Oregon', ], negative=['city', 'government'])
Out[15]: